home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Demos / OOFILE / Buildable, limited OOFILE / OOFILE headers / oof4.inl < prev    next >
Encoding:
Text File  |  1995-09-24  |  3.3 KB  |  171 lines  |  [TEXT/CWIE]

  1. // COPYRIGHT 1994 A.D. Software, All rights reserved
  2.  
  3. // OOFILE database numeric fields
  4.  
  5. // inline definitions
  6.  
  7.  
  8. // -------------------------------------------------------
  9. //                   d b S h o r t 
  10. // -------------------------------------------------------
  11. inline dbShort& dbShort::operator=(long rhs)
  12. {
  13. #ifdef OOF_Debug
  14.     CheckRange(rhs, SHRT_MIN, SHRT_MAX, __FILE__, __LINE__);
  15. #endif
  16.     *this = (short)rhs;
  17.     return *this;
  18. }
  19.  
  20.  
  21. inline dbShort& dbShort::operator=(int rhs)  // assume same as long
  22. {
  23. #ifdef OOF_Debug
  24.     CheckRange((long)rhs, SHRT_MIN, SHRT_MAX, __FILE__, __LINE__);
  25. #endif
  26.     *this = (short)rhs;
  27.     return *this;
  28. }
  29.  
  30.  
  31. inline dbShort& dbShort::operator=(double rhs)
  32. {
  33. #ifdef OOF_Debug
  34.     CheckRange(rhs, SHRT_MIN, SHRT_MAX, __FILE__, __LINE__);
  35. #endif
  36.     *this = (short)rhs;
  37.     return *this;
  38. }
  39.  
  40.  
  41. inline ostream& operator<<(ostream& os, dbShort& fld)
  42. {
  43.     fld.extract(os);
  44.     return os;
  45. }
  46.  
  47.  
  48. // -------------------------------------------------------
  49. //                   d b U s h o r t 
  50. // -------------------------------------------------------
  51. inline dbUshort& dbUshort::operator=(long rhs)
  52. {
  53. #ifdef OOF_Debug
  54.     CheckRange(rhs, USHRT_MAX, __FILE__, __LINE__);
  55. #endif
  56.     *this = (unsigned short)rhs;
  57.     return *this;
  58. }
  59.  
  60.  
  61. inline dbUshort& dbUshort::operator=(int rhs)  // assume same as long
  62. {
  63. #ifdef OOF_Debug
  64.     CheckRange((unsigned long)rhs, USHRT_MAX, __FILE__, __LINE__);
  65. #endif
  66.     *this = (unsigned short)rhs;
  67.     return *this;
  68. }
  69.  
  70.  
  71. inline dbUshort& dbUshort::operator=(double rhs)
  72. {
  73. #ifdef OOF_Debug
  74.     CheckRange((unsigned long)rhs, USHRT_MAX, __FILE__, __LINE__);
  75. #endif
  76.     *this = (unsigned short)rhs;
  77.     return *this;
  78. }
  79.  
  80.  
  81. inline ostream& operator<<(ostream& os, dbUshort& fld)
  82. {
  83.     fld.extract(os);
  84.     return os;
  85. }
  86.  
  87.  
  88. // -------------------------------------------------------
  89. //                      d b L o n g
  90. // -------------------------------------------------------
  91. inline dbLong& dbLong::operator=(int rhs)
  92. {
  93.     *this = (long)rhs;
  94.     return *this;
  95. }
  96.  
  97.  
  98. inline dbLong& dbLong::operator=(double rhs)
  99. {
  100. #ifdef OOF_Debug
  101.     CheckRange(rhs, LONG_MIN, LONG_MAX, __FILE__, __LINE__);
  102. #endif
  103.     *this = (long)rhs;
  104.     return *this;
  105. }
  106.  
  107.  
  108. inline ostream& operator<<(ostream& os, dbLong& fld)
  109. {
  110.     fld.extract(os);
  111.     return os;
  112. }
  113.  
  114.  
  115. // -------------------------------------------------------
  116. //                      d b U l o n g
  117. // -------------------------------------------------------
  118. inline dbUlong& dbUlong::operator=(unsigned int rhs)
  119. {
  120. #ifdef OOF_Debug
  121.     CheckRange(rhs, ULONG_MAX, __FILE__, __LINE__);
  122. #endif
  123.     *this = (unsigned long)rhs;
  124.     return *this;
  125. }
  126.  
  127.  
  128. inline dbUlong& dbUlong::operator=(double rhs)
  129. {
  130. #ifdef OOF_Debug
  131.     CheckRange((unsigned long)rhs, ULONG_MAX, __FILE__, __LINE__);
  132. #endif
  133.     *this = (unsigned long)rhs;
  134.     return *this;
  135. }
  136.  
  137.  
  138. inline ostream& operator<<(ostream& os, dbUlong& fld)
  139. {
  140.     fld.extract(os);
  141.     return os;
  142. }
  143.  
  144.  
  145. // -------------------------------------------------------
  146. //                      d b D a t e
  147. // -------------------------------------------------------
  148. inline ostream& operator<<(ostream& os, dbDate& fld)
  149. {
  150.     fld.extract(os);
  151.     return os;
  152. }
  153.  
  154.  
  155. inline void dbDate::setString(const char* str)
  156. {
  157.     dbDate::operator=(str);
  158. }
  159.  
  160.  
  161. // -------------------------------------------------------
  162. //                      d b R e a l
  163. // -------------------------------------------------------
  164. inline ostream& operator<<(ostream& os, dbReal& fld)
  165. {
  166.     fld.extract(os);
  167.     return os;
  168. }
  169.  
  170.  
  171.